
CC = gcc
CXX = g++

CFLAGS = -I/home/liuyao/lzp/pcre-8.30/build/include 
LDFLAG = -L/home/liuyao/lzp/pcre-8.30/build/lib -lpcre

.c.o:
	@echo ------ $*.c ------ ------ ------ ------
#$(rm) $@
	$(CC) $(CFLAGS) $(CINCLUDES) $(DEBUGFLAG) $(WARNING) -c $*.c

.cpp.o:
	@echo ------ $*.cpp ------ ------ ------ ------
#$(rm) $@
	$(CXX) $(CFLAGS) $(CPPINCLUDES) $(DEBUGFLAG) $(WARNING) -c $*.cpp

all: allTarget

target_all = 

#output_example
target_demo = pcredemo
target_all += $(target_demo)
$(target_demo)_c_srcs =  
$(target_demo)_cpp_srcs = pcredemo.cpp pcre_wrapper.cpp
$(target_demo)_objs = $($(target_demo)_c_srcs:.c=.o)
$(target_demo)_objs += $($(target_demo)_cpp_srcs:.cpp=.o)  
$(target_demo):$($(target_demo)_objs)
	@echo -------- build $(target_demo) --------
	$(CXX) $($(target_demo)_objs) -o $@ $(CFLAGS) $(LDFLAG)
	@echo -------- Done ---- ---- ----- ----
	@echo


target_hs = hs_parser
target_all += $(target_hs)
$(target_hs)_c_srcs =  
$(target_hs)_cpp_srcs = hs_parser.cpp pcre_wrapper.cpp
$(target_hs)_objs = $($(target_hs)_c_srcs:.c=.o)
$(target_hs)_objs += $($(target_hs)_cpp_srcs:.cpp=.o)  
$(target_hs):$($(target_hs)_objs)
	@echo -------- build $(target_hs) --------
	$(CXX) $($(target_hs)_objs) -o $@ $(CFLAGS) $(LDFLAG)
	@echo -------- Done ---- ---- ----- ----
	@echo

target_img = img_parser
target_all += $(target_img)
$(target_img)_c_srcs =  
$(target_img)_cpp_srcs = img_parser.cpp pcre_wrapper.cpp
$(target_img)_objs = $($(target_img)_c_srcs:.c=.o)
$(target_img)_objs += $($(target_img)_cpp_srcs:.cpp=.o)  
$(target_img):$($(target_img)_objs)
	@echo -------- build $(target_img) --------
	$(CXX) $($(target_img)_objs) -o $@ $(CFLAGS) $(LDFLAG)
	@echo -------- Done ---- ---- ----- ----
	@echo

	
allTarget: $(target_all)


clean:
	rm -rf *.o $(target_all)
